<template>
    <div class="home">
        <img alt="Vue logo" src="../assets/logo.png">
        用户名：<el-input v-model="loginData.userName" placeholder="请输入用户名" ></el-input>
        密码：<el-input v-model="loginData.password" placeholder="请输入密码" show-password></el-input>
        <el-button type="primary" @click="doLogin">登录</el-button>
    </div>
</template>

<script>

    import axios from 'axios'

    export default {
        name: 'Home',
        data(){
            return{
                loginData:{
                    userName:'',
                    password:''
                }
            }
        },
        methods:{
            doLogin(){
                axios
                    .post('/doLogin',{
                        loginData: this.loginData
                    })
                    .then(function (response) {
                        console.log(response)
                    })
                // .error(function (error) {
                //     console.log(error)
                // })
            }
        }
    }
</script>
